﻿//输入必须是字母、数字、下划线，并且字符串以字母开始。
function checkStringNum(value) {
    var v = $.trim(value);
    var patrn = /^[^a-zA-Z]/;
    var patrn2 = /\W/;
    if (patrn.test(value) || !patrn2.test(value)) {
        return false;
    }
    return true;
}
//输入必须是>=8位，必须包含数字、字母、特殊字符
function checkPwdNum(value) { 
    var pattern = /^(?!\D+$)(?![^a-zA-Z]+$)\S{8,20}$/;
    var b = pattern.test(value);
    if (b) {
        var otherasc = 0;
        for (var i = 0; i < value.length; i++) {
            var asciiNumber = value.substr(i, 1).charCodeAt(); 
            if ((asciiNumber >= 33 && asciiNumber <= 47) || (asciiNumber >= 58 && asciiNumber <= 64) || (asciiNumber >= 91 && asciiNumber <= 96) || (asciiNumber >= 123 && asciiNumber <= 126)) {
                return true; 
            }
        }
        return false;
    } 
    return false;
}
//是否为空
function IsNullOrEmpty(value) {
    var v = $.trim(value);
    if (v == "" || v == null || typeof (value).toLowerCase() == "undefined") return true;
    return false;
}

//返回到地址
function goto(url) {
    window.location.href = url;
}
//回退
function back() {
    window.history.back();
}
//CheckEmail
function CheckEmail(v) {
    if (!v.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)) {
        return false;
    }
    return true;
}
//CheckMobile
function CheckMobile(v) {
    if (!v.match(/^1[3|4|5|8][0-9]\d{4,8}$/)) {
        return false;
    }
    return true;
}  